<template>
  <div class="box">
    <select-city v-model="cityInfo" class="select-city" @input="chooseAddress"></select-city>
  </div>
</template>

<script>
  import SelectCity from './SelectCity'
    export default {
      name: "Fucity",
      components: {
        SelectCity
      },
      data () {
        return {

        }
      },
      methods: {
        // info 为子组件传递过来的参数
        chooseAddress (info) {
          this.cityInfo = info
        },

      },
      computed: {
        //cityName 为选择的省市区名称
        cityName() {
          const names = [];
          this.cityInfo.province && names.push(this.cityInfo.province.name + ' ')
          this.cityInfo.city     && names.push(this.cityInfo.city.name + ' ')
          this.cityInfo.block    && names.push(this.cityInfo.block.name + ' ')
          return names.join('')
        }
      }
    }
</script>

<style scoped>
    .box{
      font-size: 30px;
    }
</style>
